class Solution {
public:
    int lengthOfLongestSubstring(string s) {
        if(s.size() == 0) return 0;
        int res = 0;
        for(int i = 0; i < s.size(); i++)
        {
            string ss = "";
            ss += s[i];
            for(int j = i + 1; j < s.size(); j++)
            {
                if(find(ss.begin(), ss.end(), s[j]) == ss.end()) ss += s[j];
                else break;
            }
            if(ss.size() > res) res = ss.size();
        }
        return res;
    }
};